package com.hzcx.app.simplechat.ui.setting;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;

import com.hzcx.app.simplechat.R;
import com.hzcx.app.simplechat.base.BaseActivity;
import com.hzcx.app.simplechat.common.Common;
import com.hzcx.app.simplechat.util.sp.SPUtils;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 通知设置
 */
public class SettingNoticeActivity extends BaseActivity {
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.iv_title_right)
    ImageView ivTitleRight;
    @BindView(R.id.tv_title_right)
    TextView tvTitleRight;
    @BindView(R.id.tv_tips)
    TextView tvTips;
    @BindView(R.id.tv_voice)
    TextView tvVoice;
    @BindView(R.id.switch_voice)
    Switch switchVoice;
    @BindView(R.id.tv_shock)
    TextView tvShock;
    @BindView(R.id.switch_shock)
    Switch switchShock;

    private boolean isVoice = false;
    private boolean isShock = false;

    @Override
    public int getLayout() {
        return R.layout.activity_setting_notice;
    }

    @Override
    public void initPresenter() {

    }

    @Override
    public void initView() {
        tvTitle.setText("通知设置");
        tvTips.setText("正在使用" + getResources().getString(R.string.app_name) + "时");

        isVoice = (boolean) SPUtils.get(this, Common.SWITCH_VOICE, true);
        isShock = (boolean) SPUtils.get(this, Common.SWITCH_SHOCK, true);

        if (isVoice) {
            switchVoice.setChecked(true);
        }

        if (isShock) {
            switchShock.setChecked(true);
        }

        switchVoice.setOnCheckedChangeListener((compoundButton, b) -> {
            SPUtils.put(SettingNoticeActivity.this, Common.SWITCH_VOICE, b);
        });

        switchShock.setOnCheckedChangeListener((compoundButton, b) -> {
            SPUtils.put(SettingNoticeActivity.this, Common.SWITCH_SHOCK, b);
        });
    }

    @Override
    public void initData() {

    }

}
